/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import models.pelicula.enums.TipoClasificacion;
import models.pelicula.enums.TipoGenero;
import play.data.validation.MinSize;
import play.db.jpa.Model;

/**
 *
 * @author alex
 */

@Entity
public class Pelicula extends Model{
    
    public String titulo;
    public TipoGenero tipoGenero;
    public Integer duracion;
    
    public TipoClasificacion tipoClasificacion;
    @MinSize(value=8, message = "Sinopsis muy corta") 
    public String sinopsis;
    
    @OneToMany
    public List<Reparto> elenco = new ArrayList<>();

    public Pelicula( String titulo, TipoGenero tipoGenero, Integer duracion, TipoClasificacion tipoClasificacion, String sinopsis) {
        this.titulo = titulo;
        this.tipoGenero = tipoGenero;
        this.duracion = duracion;
        this.tipoClasificacion = tipoClasificacion;
        this.sinopsis = sinopsis;
    }

   public Pelicula() {
    }

    @Override
    public String toString() {
        return  this.id + " - " + this.titulo + " - " + 
                this.tipoGenero + " - " + this.duracion + " - " + 
                this.tipoClasificacion + " - " + this.sinopsis; 
    }
   
   
   
}

